package com.isorf.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.isorf.mapper.ShoeSizeMapper;
import com.isorf.pojo.ShoeSize;
import com.isorf.service.ShoeSizeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShoeSizeServiceImpl implements ShoeSizeService {
    @Autowired
    private ShoeSizeMapper shoeSizeMapper;

    @Override
    public Boolean addShoeSize(ShoeSize shoeSize) {
        int result = shoeSizeMapper.addShoeSize(shoeSize);
        return result > 0;
    }

    @Override
    public Boolean deleteShoeSize(int sizeId) {
        int result = shoeSizeMapper.deleteShoeSize(sizeId);
        return result > 0;
    }

    @Override
    public Boolean updateShoeSize(ShoeSize shoeSize) {
        int result = shoeSizeMapper.updateShoeSize(shoeSize);
        return result > 0;
    }

    @Override
    public ShoeSize getShoeSizeById(int sizeId) {
        return shoeSizeMapper.getShoeSizeById(sizeId);
    }

    @Override
    public PageInfo<ShoeSize> pageList(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<ShoeSize> list = shoeSizeMapper.getAllShoeSizes();
        return new PageInfo<>(list);
    }

    @Override
    public List<ShoeSize> getAllShoeSizes() {
        return shoeSizeMapper.getAllShoeSizes();
    }
} 